﻿<Window x:Class="Brjnk.GpxExplorer.UI.SearchTimeWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:l="clr-namespace:Brjnk.GpxExplorer.Localization"
        xmlns:my="clr-namespace:Brjnk.GpxExplorer.UI.Controls"
        Title="{l:Loc titleSearchTime}"
        MinWidth="400"
        DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"
        FocusManager.FocusedElement="{Binding ElementName=timeTxb}"
        ResizeMode="NoResize"
        SizeToContent="WidthAndHeight"
        WindowStartupLocation="CenterOwner">
    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="48" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Grid.ColumnSpan="2" Text="{l:Loc searchTimeInfo}" />
        <TextBox Name="timeTxb"
                 Grid.Row="1"
                 Style="{StaticResource HeaderTextBoxStyle}"
                 Text="{Binding Time}" />

        <CheckBox Grid.Row="2"
                  Content="{l:Loc searchTimeSearchInGaps}"
                  IsChecked="{Binding SearchInGaps}" />

        <my:ColorPicker x:Name="colorPicker"
                        Grid.Row="3"
                        Width="150"
                        Margin="3"
                        HorizontalAlignment="Left"
                        Color="Brown" />

        <StackPanel Grid.Row="3"
                    HorizontalAlignment="Right"
                    Orientation="Horizontal">
            <Button Click="Button_Click"
                    Content="{l:Loc cancel}"
                    IsCancel="True" />
            <Button Name="okButton"
                    Click="Button_Click_1"
                    Content="{l:Loc ok}"
                    IsDefault="true">
                <Button.Style>
                    <Style BasedOn="{StaticResource ResourceKey={x:Type Button}}" TargetType="Button">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=timeTxb, Path=(Validation.HasError)}" Value="true">
                                <Setter Property="Button.IsEnabled" Value="false" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
        </StackPanel>
    </Grid>
</Window>